<template>
	<view class="content">
		<div class="pos-rel" v-if="loading">

			<!-- 内容 -->
			<div class="main mt-20">
				<div class="contentBox">

					<view class="job-card" v-for="(job, index) in positionList" :key="index" @click="goJobDetail(job)">
						<view class="card-top">
							<text class="job-title">{{ job.professionName || '' }}</text>
							<text class="job-salary">{{ job.salary || "" }}·{{ job.salaryMonth || "" }}薪</text>
						</view>
						<view class="card-company">
							<text>{{ job.companyName }} </text>
							<text class="card-company-location">{{ job.areaName || '' }}</text>
						</view>
						<view class="card-tags" v-if="job.postKey.length > 0">
							<text class="tag" v-for="tag in job.postKey.split(',')" :key="tag">{{ tag }}</text>
						</view>
						<view class="card-bottom">
							<view class="hr-info">
								<text class="hr-name">{{ job.creator || '' }}·{{ job.creatorPostName || '' }}</text>
							</view>
							<!-- <view class="online-status">
								<view class="dot"></view>
								<text>当前在线</text>
							</view> -->
						</view>
					</view>
				</div>
			</div>

		</div>

	</view>
</template>

<script>
import {
	appCompanyPostList
} from "@/api/index";
import {
	tutorList,
} from "@/api/serve";
export default {
	data() {
		return {
			headerHeight: 0, // 用于存储头部高度
			baseUrl: getApp().globalData.baseUrl,
			isShowbar: false,
			isBack: false,
			custom: null,
			loading: false,
			navTop: null,
			companyId: null,
			positionList: []



		};
	},
	computed: {
		userInfo() {
			return this.$store.getters.userInfo;
		},
	},
	onShareTimeline() {
		return {
			title: this.shareLine.title,
			// imageUrl: this.shareLine.imageUrl,
		}
	},
	mounted() {

		// 动态获取头部高度
		const query = uni.createSelectorQuery().in(this);
		query.select('.header').boundingClientRect(data => {
			if (data) {
				console.log(data)
				this.headerHeight = data.height;
			}
		}).exec();

	},



	async onLoad(option) {

		let custom = wx.getMenuButtonBoundingClientRect()
		this.btnRight = uni.upx2px(30) + custom.width
		this.custom = custom
		this.navTop = custom.top - this.statusBarHeight

		this.companyId = option.companyId
		await this.getPositionList()
	},

	async onShow() {




	},

	methods: {

		// 职位列表
		async getPositionList() {
			const {
				rows
			} = await appCompanyPostList({
				companyId: this.companyId
			});
			this.positionList = rows
			this.loading = true
		},
		// 跳转职位详情
		goJobDetail(item) {
			uni.navigateTo({
				url: `/pages/position/detail?positionId=${item.id}`
			})
		},
	},

	onReachBottom() {
	},
	onPullDownRefresh() {
	},
};
</script>

<style lang="less" scoped>
@import url(index.less);

page {
	background-color: #f7f7f7 !important;
}

.content {

	padding-bottom: calc(constant(safe-area-inset-bottom) + 108upx);
	/*兼容 IOS<11.2*/
	padding-bottom: calc(env(safe-area-inset-bottom) + 108upx);
	/*兼容 IOS>11.2*/

}

.contentBox {
	// padding: 20rpx;
}

.tutor-item {
	padding: 30upx 20upx;
	background: #FFFFFF;
	border-radius: 8rpx;
	display: flex;
	align-items: center;

	.avator {
		width: 104upx;
		height: 104upx;
		border-radius: 8rpx;
	}

	.label {
		margin-top: 20upx;
		height: 36upx;
		background: #F2F2F2;
		border-radius: 4upx;
		line-height: 36upx;
		padding: 0 14rpx;
		font-size: 20rpx;
		color: #666666;
	}

}
</style>